<script type="text/javascript">
  var docheckpsstat='__URL__/docheckpsstat';
  var docheckpsstatandaddvolume='__URL__/docheckpsstatandaddvolume';
  var dologinout='__APP__/Usr/dologinout';
</script>

<div class='col-md-12 col-xs-12'>
  <div class='col-md-2 col-xs-2'><a class='btn btn-default btn-lg btn-block' href='__URL__/query'>返回</a></div>
  <div class='col-md-8 col-xs-8' style="text-align:center"><h3>{$pso['linefull']}</h3></div>
  <div class='col-md-2 col-xs-2'><a class='btn btn-danger btn-lg btn-block' id='chexiao'>撤销</a></div>

</div>

<div class="col-md-12 col-xs-12 panel panel-default">
  <div class="panel-body">
    <div class='col-md-5 col-xs-5'><h4>SKU:{$pso['partnm']}</h4></div>
    <div class='col-md-3 col-xs-3'><h4>包材码:{$pso['partcode']}</h4></div>
    <div class='col-md-2 col-xs-2'><h4>{$bancio['bancinm']}</h4></div>
    <div class='col-md-2 col-xs-2'><h4>{$tm}</h4></div>
  </div>
</div>

<?php
$zong=$pso['psvolume'];$already=$pso['psalready'];$remain=$zong-$already;
$alreadypercent=round($already/$zong*100,2).'%';
$remainpercent=(100-round($already/$zong*100,2)).'%';
?>

<style type="text/css">.slot{height:30px;}</style>
<div class="col-md-12 col-xs-12 panel panel-default">
  <div class="panel-body">
    <div class="col-md-12 col-xs-12"><div class="col-md-1 col-xs-1"></div><div class="col-md-11 col-xs-11" ><div style="text-align:right;width:100%"><h4>{$zong}/100%</h4></div></div></div>
    <div class="col-md-12 col-xs-12"><div class="col-md-1 col-xs-1"><h4>总订单</h4></div><div class="col-md-11 col-xs-11" ><div style="background-color:#5bc0de;height:30px;width:100%"></div></div></div>
    <div class="col-md-12 col-xs-12"><div class="col-md-1 col-xs-1"></div><div class="col-md-11 col-xs-11"><div style="text-align:right;width:{$alreadypercent}"><h4>{$already}/{$alreadypercent}</h4></div></div></div>
    <div class="col-md-12 col-xs-12"><div class="col-md-1 col-xs-1"><h4>已运送</h4></div><div class="col-md-11 col-xs-11"><div style="background-color:#5bc0de;height:30px;width:{$alreadypercent}"></div></div></div>
    <div class="col-md-12 col-xs-12"><div class="col-md-1 col-xs-1"></div><div class="col-md-11 col-xs-11"><div class='pull-right' style="text-align:left;width:{$remainpercent}"><h4>{$remain}/{$remainpercent}</h4></div></div></div>
    <div class="col-md-12 col-xs-12"><div class="col-md-1 col-xs-1"><h4>剩余订单量</h4></div><div class="col-md-11 col-xs-11"><div class='pull-right' style="background-color:#337ab7;height:30px;width:{$remainpercent}"></div></div></div>
</div>

<div class="col-md-12 col-xs-12 panel panel-default">
  <div class="panel-body">
  <?php 
  $psleavetm=$pso['psleavetm'];
  if($psleavetm>=90){
    $wdt='100%';$clr='#5cb85c';
  }else if($psleavetm>=$yuzhio['yuzhiyellow']){
    $wdt=($psleavetm/90*100).'%';$clr='#5cb85c';
  }else if($psleavetm>=$yuzhio['yuzhired']){
    $wdt=($psleavetm/90*100).'%';$clr='#f0ad4e';
  }else{
    $wdt=($psleavetm/90*100).'%';$clr='#c9302c';
  } 
  ?>
    <div class="col-md-12 col-xs-12"><div class="col-md-1 colxs-1"><h4>线边实时库存</h4></div><div class="col-md-1 col-xs-1"><h4>{$pso['xianbiantm']}</h4></div><div class='col-md-10 col-xs-10'><div style="width:{$wdt};background-color:{$clr};height:30px"></div></div>
  </div>
</div>

<div class="col-md-12 col-xs-12 panel panel-default">
  <div class="panel-body">
    <div class="col-md-12 col-xs-12"><div class="col-md-5 col-xs-5" style="padding:2px;background-color:#f0ad4e">
      <form class="form-horizontal">
      <div class="form-group">
        <label for="inputEmail3" class="col-sm-2 control-label">stock bottle</label>
        <div class="col-sm-10">
          <input type="telephone" class="form-control" placeholder="" style="border:0px solid red;background-color:transparent;" value="{$pso[partvolumeperpa]}" id='peisongliang'>
        </div>
      </div>
      </form>
    </div><div class="col-md-2 col-xs-2"></div><div class="col-md-5 col-xs-5" style="padding:6px;background-color:#f0ad4e;text-align:center"><h4>Take time:{$yuzhio['yuzhitaketime']} min</h4></div></div>
  </div>
</div>
<style>
.danger{width: 50px;height:50px;background-color: #c9302c;border-radius: 50%}
.success{width: 50px;height:50px;background-color: #5cb85c;border-radius: 50%}
.warning{width: 50px;height:50px;background-color: #f0ad4e;border-radius: 50%}
</style>
<div class="col-md-12 col-xs-12 panel panel-default">
  <div class="panel-body">
    <div class="col-md-12 col-xs-12"><div class="col-md-6 col-xs-6"><div class="{$pso['yuzhistat']}" style='margin:0 auto;'></div></div><div class="col-md-6 col-xs-6"><a class='btn btn-success btn-lg btn-block' id='complete'>配送完成</a></div></div>
  </div>
</div>

<script type="text/javascript">
$(function(){
  var obj=new Object();
  obj['psid']={$pso['psid']};
  $('#chexiao').click(function(){
    if(confirm('真的要撤销吗？')){
      $.ajax({
          'type': 'GET',
          'url':docheckpsstat,
          'async':false,  
          'contentType': 'application/json',
          'data': obj,
          'dataType': 'json',
          'success': function(data) {
            window.location.href='__URL__/query';
            console.log("success");
          },
          'error':function() {
              console.log("error");
          }
      });
    }
  })

  $('#complete').click(function(){
    obj['peisongliang']=$('#peisongliang').val();
    $.ajax({
        'type': 'GET',
        'url':docheckpsstatandaddvolume,
        'async':false,  
        'contentType': 'application/json',
        'data': obj,
        'dataType': 'json',
        'success': function(data) {
          window.location.href='__URL__/query';
          console.log("success");
        },
        'error':function() {
            console.log("error");
        }
    });
  })
    
  
})
  
</script>
